home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / gui4cli / dir / dir.gc.alt < prev    next >
Text File  |  1999-04-29  |  6KB  |  312 lines

  1. G4C
  2.  
  3. ; This is an alternate dir.gc which uses a separate gui for
  4. ; the favourites directories.
  5.  
  6. ; To use this dir.gc, instead of the normal one, just replace
  7. ; the dir.gc file in the main "Dir" directory with this file,
  8. ; i.e. rename dir.gc to something else and rename this file
  9. ; to dir.gc
  10.  
  11.  
  12. WINBIG 150 11 220 229   Devices
  13. WinType 11110001
  14. varpath ''
  15. nofontsense
  16.  
  17. xOnLoad
  18. setvar fm_mode 1
  19. setgad Dir.gc 2 HIDE       ; hide the gadgets of the
  20. setgad Dir.gc 10 HIDE      ; other half of the window
  21. setgad Dir.gc 11 HIDE
  22. setgad Dir.gc 12 HIDE
  23. setgad Dir.gc 13 HIDE
  24. setgad Dir.gc 14 HIDE
  25. setgad Dir.gc 15 HIDE
  26. setgad Dir.gc 16 HIDE
  27. setgad Dir.gc 17 HIDE
  28. guiopen Dir.gc
  29. guiload :Dir.g                        ; load the helper guis
  30. guiload guis:tools/cli.gc             ; the cli gui
  31. guiload guis:tools/ViewFile.g         ; auto view function
  32. guiload guis:tools/Prefs/players      ; the default viewers
  33. guiload :dir.fav                      ; the favourites gui
  34.  
  35. xonquit
  36. guiquit Dir.g        ; quit our other guis also
  37. guiquit ViewFile.g
  38. guiquit Dir.g2
  39. guiquit Dir.g3
  40. guiquit dir.g4
  41. guiquit cli.gc
  42. guiquit dir.prot
  43. guiquit dir.user
  44. guiquit dir.fav
  45.  
  46. xOnOpen
  47. SetGad dir.gc 20 OFF
  48.  
  49. xOnClose 
  50. SetGad dir.gc 20 ON
  51.  
  52.  
  53. xAppIcon 0 0 :dir.gc DIR.gc *lv_app OFF
  54. GadID 20
  55. GuiOpen dir.gc
  56. GuiScreen dir.gc FRONT
  57. if $*lv_app > " "
  58.    gosub dir.gc appdir 
  59. endif
  60.  
  61.  
  62. xAppWindow  *lv_app                ; The FM is also an AppWindow
  63. gosub dir.gc appdir                ; going to the dir of the icon..
  64.  
  65.  
  66. xroutine appdir                    ; cd to the appitem's dir
  67. ifexists DIR $*lv_app              ; if it's a dir,vol,dev or asn
  68. orifexists DOS $*lv_app
  69.     dir  = $*lv_app
  70.     file = ''
  71. elseifexists file $*lv_app          ; if it's a file
  72.     extract *lv_app PATH dir
  73.     extract *lv_app FILE file
  74. endif
  75. lvuse dir.gc 1
  76. lvdir #$dir
  77. lvfind $file
  78. setwintitle dir.gc '$dir'
  79. delvar *lv_app
  80.  
  81. xOnRMB
  82. guiopen Dir.g     ; This has the copy, delete etc functions
  83.  
  84.  
  85.  
  86. ;========================= The Directory ListViews ==================
  87. ; Note they both have Hooks to display the current dir to the user.
  88.  
  89. ;---------> the left side
  90.  
  91. XLISTVIEW 0 0 204 228              "" lv_file "" 10 DIR
  92. gadid 1
  93. lvdirhook 1
  94. GadFont topaz.font 8 000        ; CHANGE THIS TO THE FONT YOU LIKE!
  95. ;LVColors   2 1 3 2
  96. guiopen Dir.g2
  97.  
  98. xLVDirHook 1
  99. setwintitle Dir.gc '$$lv.dir'
  100.  
  101. ;----------> the right side
  102.  
  103. XLISTVIEW 220 16 205 212              "" lv_file "" 10 DIR
  104. gadid 2
  105. lvdirhook 2
  106. GadFont topaz.font 8 000        ; CHANGE THIS TO THE FONT YOU LIKE!
  107. guiopen Dir.g2
  108.  
  109. xLVDirHook 2
  110. update Dir.gc 10 $$lv.dir       ; show it in xTextIn gadget below
  111.  
  112. XTEXTIN 220 0 204 16             "" lvdir2 "" 140
  113. gadid 10
  114. GadFont topaz.font 8 000
  115. lvuse dir.gc 2
  116. LVDir #$lvdir2   ; you can change the dir from here
  117.  
  118.  
  119.  
  120. ;======================== The Action buttons ==========================
  121.  
  122. ;--------> for the left side (source)
  123.  
  124. XBUTTON 205 0 14 13  P
  125. lvuse dir.gc 1
  126. LVDir parent
  127. lv_ir1 = $$LV_DIR
  128. setwintitle Dir.gc '$$lv.dir'
  129.  
  130. XBUTTON 205 13 14 13 R
  131. lvuse dir.gc 1
  132. LVDir Root
  133. lv_dir1 = $$LV_DIR
  134. setwintitle Dir.gc '$$lv.dir'
  135.  
  136. XBUTTON 205 26 14 13 D
  137. lvuse dir.gc 1
  138. LVDir Disks
  139. lv_dir1 = ""
  140. setwintitle Dir.gc 'Devices'
  141.  
  142. XBUTTON 205 39 14 13 A
  143. lvuse dir.gc 1
  144. LVDir all
  145.  
  146. XBUTTON 205 52 14 13 N
  147. lvuse dir.gc 1
  148. LVDir None
  149.  
  150. XBUTTON 205 65 14 15 F
  151. favid = 1
  152. guiopen dir.fav
  153.  
  154. XBUTTON 205 177 14 12 +      ; add to favourites
  155. lvuse dir.gc 1
  156. gosub dir.fav addfav
  157.  
  158. XBUTTON 205 189 14 13 R
  159. lvuse dir.gc 1
  160. lvdir Refresh
  161.  
  162. XBUTTON 205 202 14 13                <       ; move list left
  163. lvuse dir.gc 1
  164. lvmove -10
  165.  
  166. XBUTTON 205 215 14 13                >
  167. lvuse dir.gc 1
  168. lvmove 10
  169.  
  170. ;---------> for the right side (destination) give gadID so we set them on/off
  171.  
  172. XBUTTON 426 0 14 13             P
  173. GadID 11
  174. lvuse dir.gc 2
  175. LVDir parent
  176. setvar lv_dir2 $$LV.DIR
  177. update Dir.gc 10 $$lv.dir
  178.  
  179. XBUTTON 426 13 14 13             R
  180. gadid 12
  181. lvuse dir.gc 2
  182. LVDir Root
  183. setvar lv_dir2 $$LV.DIR
  184. update Dir.gc 10 $$lv.dir
  185.  
  186. XBUTTON 426 26 14 13             D
  187. gadid 13
  188. lvuse dir.gc 2
  189. LVDir Disks
  190. setvar lv_dir2 ""
  191. update Dir.gc 10 ""
  192.  
  193. XBUTTON 426 39 14 13             A
  194. gadid 14
  195. lvuse dir.gc 2
  196. LVDir All
  197.  
  198. XBUTTON 426 52 14 13             N
  199. gadid 15
  200. lvuse dir.gc 2
  201. LVDir None
  202.  
  203. XBUTTON 426 65 14 15    F
  204. gadid 151
  205. favid = 2
  206. guiopen dir.fav
  207.  
  208. XBUTTON 426 178 14 11              +      ; add to favourites
  209. lvuse dir.gc 2
  210. gosub dir.fav addfav
  211.  
  212. XBUTTON 426 189 14 13              R
  213. lvuse dir.gc 2
  214. lvdir Refresh
  215.  
  216. XBUTTON 426 202 14 13              <    ; move list left
  217. GadID 16
  218. lvuse dir.gc 2
  219. lvmove -10
  220.  
  221. XBUTTON 426 215 14 13              >    ; move list right
  222. GadID 17
  223. lvuse dir.gc 2
  224. lvmove 10
  225.  
  226. ;---------> open full file manager
  227.  
  228. XBUTTON 205 108 14 11             >
  229. gadid 21
  230. if $fm_mode = 1
  231.    gosub Dir.gc OpenWindow
  232. else
  233.    gosub Dir.gc CloseWindow
  234. endif
  235.  
  236.  
  237. ;--------> button to switch left <-> right lvs
  238.  
  239. XBUTTON 205 119 14 11             x
  240. gadid  20
  241. lvuse dir.gc 1
  242. tempdir1 = $$lv.dir
  243. lvuse dir.gc 2
  244. tempdir2 = $$lv.dir
  245. lvdir #$tempdir1
  246. lvuse dir.gc 1
  247. lvdir #$tempdir2
  248. setwintitle Dir.gc '$tempdir2'
  249. update Dir.gc 10 $tempdir1
  250. delvar tempdir#?
  251.  
  252.  
  253. ;--------> same directories
  254.  
  255. XBUTTON 205 130 14 11               =
  256. if $$lv.gui == dir.gc        ; check that the internal vars point to us
  257.    id  = $$lv.id
  258.    dir = $$lv.dir
  259.    if $id = 1
  260.       lvuse dir.gc 2 
  261.       lvdir #$dir
  262.       update Dir.gc 10 $dir
  263.    else
  264.       lvuse dir.gc 1
  265.       lvdir #$dir
  266.       setwintitle Dir.gc '$dir'
  267.    endif
  268. endif
  269.  
  270. ;---------> open favourites gui
  271.  
  272. XBUTTON 205 65 14 15                 F
  273. favid = 1
  274. guiopen dir.fav
  275.  
  276.  
  277. ;---------> ROUTINES
  278.  
  279. xRoutine OpenWindow     ; Routine to enlarge the window
  280.    fm_mode = 2
  281.    setgad Dir.gc 2   SHOW
  282.    setgad Dir.gc 10  SHOW
  283.    setgad Dir.gc 11  SHOW
  284.    setgad Dir.gc 12  SHOW
  285.    setgad Dir.gc 13  SHOW
  286.    setgad Dir.gc 14  SHOW
  287.    setgad Dir.gc 15  SHOW
  288.    setgad Dir.gc 151 SHOW
  289.    setgad Dir.gc 16  SHOW
  290.    setgad Dir.gc 17  SHOW
  291.    changearg Dir.gc 21 4 <
  292.    changegad Dir.gc 0 -1 -1 440 229 ""
  293.    redraw Dir.gc
  294.  
  295. xRoutine CloseWindow    ; make it small again
  296.    fm_mode = 1
  297.    setgad Dir.gc 2   HIDE
  298.    setgad Dir.gc 10  HIDE
  299.    setgad Dir.gc 11  HIDE
  300.    setgad Dir.gc 12  HIDE
  301.    setgad Dir.gc 13  HIDE
  302.    setgad Dir.gc 14  HIDE
  303.    setgad Dir.gc 15  HIDE
  304.    setgad Dir.gc 151 HIDE
  305.    setgad Dir.gc 16  HIDE
  306.    setgad Dir.gc 17  HIDE
  307.    changegad Dir.gc 0 -1 -1 220 229 ""
  308.    changearg Dir.gc 21 4 >
  309.    redraw Dir.gc
  310.  
  311.  
  312.